<?php

namespace Database\Factories;

use App\Models\Content\Article;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Facades\Hash;

/**
 * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
 */
class ArticleFactory extends Factory
{
    protected $model = Article::class;
    /**
     * The current password being used by the factory.
     */
    protected static ?string $password;

    /**
     * Define the model's default state.
     *
     * @return array<string, mixed>
     */
    public function definition(): array
    {
        $faker = fake("zh_CN");
        return [
            'key' => uniqid(),
            'category_id' => 0,
            'picture' => $faker->image,
            'title' => $faker->sentence(7, true),
            'content' => $faker->paragraphs(4, true),
            'sort' => $faker->numberBetween(1,1000),
            'state' => $faker->randomElement([0,1,-1]),
            'views'=> $faker->numberBetween(0,10000),
            'likes'=> $faker->numberBetween(0,10000),
            'seo' => json_encode([
                "title" =>  $faker->sentence(10, true),
                "keywords" => $faker->words(7, true),
                "description" => $faker->realText(),
            ],JSON_UNESCAPED_UNICODE),
            'admin_id' => 1,
            'publish_at' => $faker->dateTime,
            'created_at' => $faker->dateTime,
            'updated_at' => $faker->dateTime,
        ];
    }
}
